package com.inei.evaluacionemype.controller.activity;

import com.inei.evaluacionemype.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;

public class CapituloIII_Activity extends Activity {

	// componentes
	private EditText etC3_01_01, etC3_01_02, etC3_01_03, etC3_01_04,
			etC3_02_01, etC3_02_02, etC3_02_03, etC3_02_04, etC3_03_01,
			etC3_03_02, etC3_03_03, etC3_03_04, etC3_04_01, etC3_04_02,
			etC3_04_03, etC3_04_04, etC3_05_01, etC3_05_02, etC3_05_03,
			etC3_05_04, etC3_06_01, etC3_06_02, etC3_06_03, etC3_06_04,
			etC3_07_01, etC3_07_02, etC3_07_03, etC3_07_04, etC3_08_01,
			etC3_08_02, etC3_08_03, etC3_08_04, etC3_09_01, etC3_09_02,
			etC3_09_03;

	// variables

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_capitulo_iii);

		IniciarComponentes();

		AgregarEventos();

		CargarDatos();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.capitulo_iii, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.mnGuardar:
			GuardarDatos();
			Intent ir_cap4_1 = new Intent(this,
					CapituloIV_ParteI_Activity.class);
			startActivity(ir_cap4_1);
			finish();
			break;

		case R.id.mnSalir:
			finish();
			break;

		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onBackPressed() {
		Intent ir_cap2 = new Intent(this, CapituloII_Activity.class);
		ir_cap2.putExtras(getIntent().getExtras());
		startActivity(ir_cap2);
		finish();
		super.onBackPressed();
	}

	private void IniciarComponentes() {
		etC3_01_01 = (EditText) findViewById(R.id.etC3_01_01);
		etC3_01_02 = (EditText) findViewById(R.id.etC3_01_02);
		etC3_01_03 = (EditText) findViewById(R.id.etC3_01_03);
		etC3_01_04 = (EditText) findViewById(R.id.etC3_01_04);
		etC3_02_01 = (EditText) findViewById(R.id.etC3_02_01);
		etC3_02_02 = (EditText) findViewById(R.id.etC3_02_02);
		etC3_02_03 = (EditText) findViewById(R.id.etC3_02_03);
		etC3_02_04 = (EditText) findViewById(R.id.etC3_02_04);
		etC3_03_01 = (EditText) findViewById(R.id.etC3_03_01);
		etC3_03_02 = (EditText) findViewById(R.id.etC3_03_02);
		etC3_03_03 = (EditText) findViewById(R.id.etC3_03_03);
		etC3_03_04 = (EditText) findViewById(R.id.etC3_03_04);
		etC3_04_01 = (EditText) findViewById(R.id.etC3_04_01);
		etC3_04_02 = (EditText) findViewById(R.id.etC3_04_02);
		etC3_04_03 = (EditText) findViewById(R.id.etC3_04_03);
		etC3_04_04 = (EditText) findViewById(R.id.etC3_04_04);
		etC3_05_01 = (EditText) findViewById(R.id.etC3_05_01);
		etC3_05_02 = (EditText) findViewById(R.id.etC3_05_02);
		etC3_05_03 = (EditText) findViewById(R.id.etC3_05_03);
		etC3_05_04 = (EditText) findViewById(R.id.etC3_05_04);
		etC3_06_01 = (EditText) findViewById(R.id.etC3_06_01);
		etC3_06_02 = (EditText) findViewById(R.id.etC3_06_02);
		etC3_06_03 = (EditText) findViewById(R.id.etC3_06_03);
		etC3_06_04 = (EditText) findViewById(R.id.etC3_06_04);
		etC3_07_01 = (EditText) findViewById(R.id.etC3_07_01);
		etC3_07_02 = (EditText) findViewById(R.id.etC3_07_02);
		etC3_07_03 = (EditText) findViewById(R.id.etC3_07_03);
		etC3_07_04 = (EditText) findViewById(R.id.etC3_07_04);
		etC3_08_01 = (EditText) findViewById(R.id.etC3_08_01);
		etC3_08_02 = (EditText) findViewById(R.id.etC3_08_02);
		etC3_08_03 = (EditText) findViewById(R.id.etC3_08_03);
		etC3_08_04 = (EditText) findViewById(R.id.etC3_08_04);
		etC3_09_01 = (EditText) findViewById(R.id.etC3_09_01);
		etC3_09_02 = (EditText) findViewById(R.id.etC3_09_02);
		etC3_09_03 = (EditText) findViewById(R.id.etC3_09_03);
	}

	private void AgregarEventos() {
		EventoEditText(etC3_01_02);
		EventoEditText(etC3_01_03);
		EventoEditText(etC3_01_04);
		EventoEditText(etC3_03_02);
		EventoEditText(etC3_03_03);
		EventoEditText(etC3_03_04);
		EventoEditText(etC3_04_02);
		EventoEditText(etC3_04_03);
		EventoEditText(etC3_04_04);
		EventoEditText(etC3_06_02);
		EventoEditText(etC3_06_03);
		EventoEditText(etC3_06_04);
		EventoEditText(etC3_07_02);
		EventoEditText(etC3_07_03);
		EventoEditText(etC3_07_04);
		EventoEditText(etC3_09_02);
		EventoEditText(etC3_09_03);
	}

	private void EventoEditText(final EditText et) {
		et.addTextChangedListener(new TextWatcher() {

			@Override
			public void onTextChanged(CharSequence s, int start, int before,
					int count) {
				int n1_1 = 0;
				int n1_2 = 0;
				int n1_3 = 0;
				int n1_4 = 0;
				int n2_1 = 0;
				int n2_2 = 0;
				int n2_3 = 0;
				int n2_4 = 0;
				int n3_1 = Integer.parseInt(etC3_03_01.getText().toString()
						.trim().length() == 0 ? "0" : etC3_03_01.getText()
						.toString());
				int n3_2 = 0;
				int n3_3 = 0;
				int n3_4 = 0;
				int n4_1 = Integer.parseInt(etC3_04_01.getText().toString()
						.trim().length() == 0 ? "0" : etC3_04_01.getText()
						.toString());
				int n4_2 = 0;
				int n4_3 = 0;
				int n4_4 = 0;
				int n5_1 = 0;
				int n5_2 = 0;
				int n5_3 = 0;
				int n5_4 = 0;
				int n6_1 = 0;
				int n6_2 = 0;
				int n6_3 = 0;
				int n6_4 = 0;
				int n7_1 = Integer.parseInt(etC3_07_01.getText().toString()
						.trim().length() == 0 ? "0" : etC3_07_01.getText()
						.toString());
				int n7_2 = 0;
				int n7_3 = 0;
				int n7_4 = 0;
				int n8_1 = Integer.parseInt(etC3_08_01.getText().toString()
						.trim().length() == 0 ? "0" : etC3_08_01.getText()
						.toString());
				int n8_2 = Integer.parseInt(etC3_08_02.getText().toString()
						.trim().length() == 0 ? "0" : etC3_08_02.getText()
						.toString());
				int n8_3 = Integer.parseInt(etC3_08_03.getText().toString()
						.trim().length() == 0 ? "0" : etC3_08_03.getText()
						.toString());
				int n8_4 = Integer.parseInt(etC3_08_04.getText().toString()
						.trim().length() == 0 ? "0" : etC3_08_04.getText()
						.toString());
				int n9_1 = Integer.parseInt(etC3_09_01.getText().toString()
						.trim().length() == 0 ? "0" : etC3_09_01.getText()
						.toString());
				int n9_2 = 0;
				int n9_3 = 0;

				switch (et.getId()) {
				case R.id.etC3_01_02:
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					etC3_01_01.setText((n1_2 + n1_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_08_02.setText((n1_2 + n2_2 + n5_2) + "");
					break;

				case R.id.etC3_01_03:
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					etC3_01_01.setText((n1_2 + n1_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_08_03.setText((n1_3 + n2_3 + n5_3) + "");
					break;

				case R.id.etC3_01_04:
					n1_4 = Integer.parseInt(etC3_01_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_04.getText()
							.toString());
					n2_4 = Integer.parseInt(etC3_02_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_04.getText()
							.toString());
					n5_4 = Integer.parseInt(etC3_05_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_04.getText()
							.toString());
					etC3_08_04.setText((n1_4 + n2_4 + n5_4) + "");
					break;

				case R.id.etC3_03_02:
					n3_2 = Integer.parseInt(etC3_03_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_02.getText()
							.toString());
					n4_2 = Integer.parseInt(etC3_04_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_02.getText()
							.toString());
					etC3_02_02.setText((n3_2 + n4_2) + "");
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_08_02.setText((n1_2 + n2_2 + n5_2) + "");
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					etC3_02_01.setText((n2_2 + n2_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n3_3 = Integer.parseInt(etC3_03_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_03.getText()
							.toString());
					etC3_03_01.setText((n3_2 + n3_3) + "");
					break;

				case R.id.etC3_03_03:
					n3_3 = Integer.parseInt(etC3_03_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_03.getText()
							.toString());
					n4_3 = Integer.parseInt(etC3_04_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_03.getText()
							.toString());
					etC3_02_03.setText((n3_3 + n4_3) + "");
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_08_03.setText((n1_3 + n2_3 + n5_3) + "");
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					etC3_02_01.setText((n2_2 + n2_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n3_2 = Integer.parseInt(etC3_03_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_02.getText()
							.toString());
					etC3_03_01.setText((n3_2 + n3_3) + "");
					break;

				case R.id.etC3_03_04:
					n3_4 = Integer.parseInt(etC3_03_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_04.getText()
							.toString());
					n4_4 = Integer.parseInt(etC3_04_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_04.getText()
							.toString());
					etC3_02_04.setText((n3_4 + n4_4) + "");
					n1_4 = Integer.parseInt(etC3_01_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_04.getText()
							.toString());
					n2_4 = Integer.parseInt(etC3_02_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_04.getText()
							.toString());
					n5_4 = Integer.parseInt(etC3_05_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_04.getText()
							.toString());
					etC3_08_04.setText((n1_4 + n2_4 + n5_4) + "");
					break;

				case R.id.etC3_04_02:
					n3_2 = Integer.parseInt(etC3_03_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_02.getText()
							.toString());
					n4_2 = Integer.parseInt(etC3_04_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_02.getText()
							.toString());
					etC3_02_02.setText((n3_2 + n4_2) + "");
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_08_02.setText((n1_2 + n2_2 + n5_2) + "");
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					etC3_02_01.setText((n2_2 + n2_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n4_3 = Integer.parseInt(etC3_04_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_03.getText()
							.toString());
					etC3_04_01.setText((n4_2 + n4_3) + "");
					break;

				case R.id.etC3_04_03:
					n3_3 = Integer.parseInt(etC3_03_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_03.getText()
							.toString());
					n4_3 = Integer.parseInt(etC3_04_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_03.getText()
							.toString());
					etC3_02_03.setText((n3_3 + n4_3) + "");
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_08_03.setText((n1_3 + n2_3 + n5_3) + "");
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					etC3_02_01.setText((n2_2 + n2_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n4_2 = Integer.parseInt(etC3_04_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_02.getText()
							.toString());
					etC3_04_01.setText((n4_2 + n4_3) + "");
					break;

				case R.id.etC3_04_04:
					n3_4 = Integer.parseInt(etC3_03_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_03_04.getText()
							.toString());
					n4_4 = Integer.parseInt(etC3_04_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_04_04.getText()
							.toString());
					etC3_02_04.setText((n3_4 + n4_4) + "");
					n1_4 = Integer.parseInt(etC3_01_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_04.getText()
							.toString());
					n2_4 = Integer.parseInt(etC3_02_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_04.getText()
							.toString());
					n5_4 = Integer.parseInt(etC3_05_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_04.getText()
							.toString());
					etC3_08_04.setText((n1_4 + n2_4 + n5_4) + "");
					break;

				case R.id.etC3_06_02:
					n6_2 = Integer.parseInt(etC3_06_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_02.getText()
							.toString());
					n7_2 = Integer.parseInt(etC3_07_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_02.getText()
							.toString());
					etC3_05_02.setText((n6_2 + n7_2) + "");
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_08_02.setText((n1_2 + n2_2 + n5_2) + "");
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_05_01.setText((n5_2 + n5_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n6_3 = Integer.parseInt(etC3_06_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_03.getText()
							.toString());
					etC3_06_01.setText((n6_2 + n6_3) + "");
					break;

				case R.id.etC3_06_03:
					n6_3 = Integer.parseInt(etC3_06_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_03.getText()
							.toString());
					n7_3 = Integer.parseInt(etC3_07_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_03.getText()
							.toString());
					etC3_05_03.setText((n6_3 + n7_3) + "");
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_08_03.setText((n1_3 + n2_3 + n5_3) + "");
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_05_01.setText((n5_2 + n5_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n6_2 = Integer.parseInt(etC3_06_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_02.getText()
							.toString());
					etC3_06_01.setText((n6_2 + n6_3) + "");
					break;

				case R.id.etC3_06_04:
					n6_4 = Integer.parseInt(etC3_06_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_04.getText()
							.toString());
					n7_4 = Integer.parseInt(etC3_07_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_04.getText()
							.toString());
					etC3_05_04.setText((n6_4 + n7_4) + "");
					n1_4 = Integer.parseInt(etC3_01_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_04.getText()
							.toString());
					n2_4 = Integer.parseInt(etC3_02_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_04.getText()
							.toString());
					n5_4 = Integer.parseInt(etC3_05_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_04.getText()
							.toString());
					etC3_08_04.setText((n1_4 + n2_4 + n5_4) + "");
					break;

				case R.id.etC3_07_02:
					n6_2 = Integer.parseInt(etC3_06_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_02.getText()
							.toString());
					n7_2 = Integer.parseInt(etC3_07_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_02.getText()
							.toString());
					etC3_05_02.setText((n6_2 + n7_2) + "");
					n1_2 = Integer.parseInt(etC3_01_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_02.getText()
							.toString());
					n2_2 = Integer.parseInt(etC3_02_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_02.getText()
							.toString());
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_08_02.setText((n1_2 + n2_2 + n5_2) + "");
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_05_01.setText((n5_2 + n5_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n7_3 = Integer.parseInt(etC3_07_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_03.getText()
							.toString());
					etC3_07_01.setText((n7_2 + n7_3) + "");
					break;

				case R.id.etC3_07_03:
					n6_3 = Integer.parseInt(etC3_06_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_03.getText()
							.toString());
					n7_3 = Integer.parseInt(etC3_07_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_03.getText()
							.toString());
					etC3_05_03.setText((n6_3 + n7_3) + "");
					n1_3 = Integer.parseInt(etC3_01_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_03.getText()
							.toString());
					n2_3 = Integer.parseInt(etC3_02_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_03.getText()
							.toString());
					n5_3 = Integer.parseInt(etC3_05_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_03.getText()
							.toString());
					etC3_08_03.setText((n1_3 + n2_3 + n5_3) + "");
					n5_2 = Integer.parseInt(etC3_05_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_02.getText()
							.toString());
					etC3_05_01.setText((n5_2 + n5_3) + "");
					n1_1 = Integer.parseInt(etC3_01_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_01.getText()
							.toString());
					n2_1 = Integer.parseInt(etC3_02_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_01.getText()
							.toString());
					n5_1 = Integer.parseInt(etC3_05_01.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_01.getText()
							.toString());
					etC3_08_01.setText((n1_1 + n2_1 + n5_1) + "");
					n7_2 = Integer.parseInt(etC3_07_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_02.getText()
							.toString());
					etC3_07_01.setText((n7_2 + n7_3) + "");
					break;

				case R.id.etC3_07_04:
					n6_4 = Integer.parseInt(etC3_06_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_06_04.getText()
							.toString());
					n7_4 = Integer.parseInt(etC3_07_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_07_04.getText()
							.toString());
					etC3_05_04.setText((n6_4 + n7_4) + "");
					n1_4 = Integer.parseInt(etC3_01_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_01_04.getText()
							.toString());
					n2_4 = Integer.parseInt(etC3_02_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_02_04.getText()
							.toString());
					n5_4 = Integer.parseInt(etC3_05_04.getText().toString()
							.trim().length() == 0 ? "0" : etC3_05_04.getText()
							.toString());
					etC3_08_04.setText((n1_4 + n2_4 + n5_4) + "");
					break;
				case R.id.etC3_09_02:
					n9_2 = Integer.parseInt(etC3_09_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_09_02.getText()
							.toString());
					n9_3 = Integer.parseInt(etC3_09_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_09_03.getText()
							.toString());
					etC3_09_01.setText((n9_2 + n9_3) + "");
					break;

				case R.id.etC3_09_03:
					n9_2 = Integer.parseInt(etC3_09_02.getText().toString()
							.trim().length() == 0 ? "0" : etC3_09_02.getText()
							.toString());
					n9_3 = Integer.parseInt(etC3_09_03.getText().toString()
							.trim().length() == 0 ? "0" : etC3_09_03.getText()
							.toString());
					etC3_09_01.setText((n9_2 + n9_3) + "");
					break;

				default:
					break;
				}
			}

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count,
					int after) {

			}

			@Override
			public void afterTextChanged(Editable s) {

			}
		});
	}

	private void CargarDatos() {

	}

	private void GuardarDatos() {

	}
}
